home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 118_01.zip / STORAGE.BDS < prev    next >
Text File  |  1993-06-03  |  2KB  |  89 lines

  1. /* Storage management routines for Software Tools & BDS C.
  2.  * source:  storage.bds
  3.  * version: August 27, 1981
  4.  */
  5.  
  6. #include tools.h
  7.  
  8. /* The only routine whose calling sequence has been
  9.  * changed is dsinit:
  10.  *
  11.  *  RATFOR:  dsinit (w)
  12.  *           int w;
  13.  *
  14.  *
  15.  * C:        dsinit ();
  16.  *
  17.  */
  18.  
  19. /*  dsinit  --  initialize the dynamic storage space */
  20.  
  21. dsinit()
  22. {
  23.     /* reserve 1000 bytes for stack at all times */
  24.     rsvstk(1000);
  25.     /* anchor the free memory space */
  26.     _allocp = NULL;
  27. }
  28.     
  29.  
  30. /*  dsfree -- return a block to the available space list */
  31.  
  32. dsfree (block)
  33. char *block;
  34. {
  35.     free(block);
  36. }
  37.  
  38. /*  dsget -- get pointer to block of n bytes */
  39.  
  40. char *dsget (n)
  41. int n;
  42. {
  43.     char *p;
  44.  
  45.     /* comment out -----
  46.     printf("In dsget:  n = %d\n", n);
  47.     ----- end comment out */
  48.  
  49.     if ((p = alloc(n)) == 0) {
  50.         error ("dsget:  out of dynamic memory");
  51.     }
  52.     return(p);
  53. }
  54.  
  55.  
  56. /* ---------- dsdump not implemented:
  57. /*  dsdump --- produce semi-readable dump of storage */
  58.  
  59. dsdump (form)
  60. char form;
  61. {
  62. }
  63. ---------- end comment out */
  64.  
  65. /* ---------- dsdbiu not implemented:
  66. /*  dsdbiu - dump contents of block-in-use */
  67.  
  68. dsdbiu (b, form)
  69. pointer b;
  70. char form;
  71. {
  72. }
  73. ---------- end comment out */
  74.  
  75. n", n);
  76.     ----- end comment out */
  77.  
  78.     if ((p = alloc(n)) == 0) {
  79.         error ("dsget:  out of dynamic memory");
  80.     }
  81.     return(p);
  82. }
  83.  
  84.  
  85. /* ---------- dsdump not implemented:
  86. /*  dsdump --- produce semi-readable dump of storage */
  87.  
  88. dsdump (form)
  89. char f